package com.example.app_huichuan;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class app_o2 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_app_o2);
        ineint();
    }
    private void ineint(){
        EditText edit_o1=findViewById(R.id.edit_01);
        Button btn=findViewById(R.id.btn_o2);
        Intent intent=getIntent();
        //接收参数时需判断是否有参数传过来，否则容易造成空指针
        String text=intent.getExtras().getString("phone");
        edit_o1.setText(text);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                intent.putExtra("new_edit",edit_o1.getText().toString());
                setResult(RESULT_OK,intent);
                finish();
            }
        });

    }
}